﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
	<meta http-equiv="pragma" content="no-cache" />
	<meta http-equiv="expires" content="-1" />
	<link rel="stylesheet" type="text/css" href="/site_media/css/style.css" />
	<title>Labmin - dane studenta</title>
</head>
<body>
	<div id="wrap">
		{% include "header.html" %}
		{% if request.session.user %}
			<div id="content-wrap">
				{% include "sidebar.html" %}
				<div id="main">
					<div class="box">
                		<h1>Dane <span class="gray">studenta</span></h1>
					</div>
				{% if error %}
					<div class="box" style="padding: 10px;">
						błąd LDAP: {{ error }}
					</div>
				{% endif %}
					<div class="box" style="padding: 10px;">
						<div>
                            <table>
								<tr>
                                    <th>login:</th>
                                    <td><b>{{ student.login }}</b></td>
                                </tr>
							{% if error %}
								<!-- mail z lokalnej bazy -->
                                <tr>
                                    <th>e-mail:</th>
                                    <td>{{ student.email }}</td>
                                </tr>
							{% else %}
								<!-- mail i inne dane z LDAPA -->
								<tr>
                                    <th>imię i nazwisko:</th>
                                    <td><b>{{ LDAPstudent.cn.0 }}</b></td>
                                </tr>
                                <tr>
                                    <th>e-mail:</th>
                                    <td>{{ LDAPstudent.mail }}</td>
                                </tr>
                                <tr>
                                    <th>kierunek:</th>
                                    <td>{{ LDAPstudent.faculty }}</td>
                                </tr>
                                <tr>
                                    <th>rok studiów:</th>
                                    <td>{{ LDAPstudent.year }}</td>
                                </tr>
							{% endif %}
								<tr>
                                    <th>grupy:</th>
                                    <td><ul style="margin:0px; color:inherit;">
										{% for student_group in student.studentgroup_set.all %}
										<li>
										<a href="/show_student_group/{{student_group.pk}}">{{ student_group.name }}</a>
										</li>
										{% endfor %}
									</ul></td>
                                </tr>
								<tr>
                                    <th>usługi:</th>
                                    <td><ul style="margin:0px; color:inherit;">
										{% for association in student.studentserviceassociation_set.select_related %}
										<li>
										<a href="/show_service/{{association.service.pk}}">{{ association.service }}</a>
										{% if not association.is_active %}
										 (nieaktywna)
										{% endif %}
										</li>
										{% endfor %}
									</ul></td>
                                </tr>
                            </table>
						</div>
					</div>
				<form action="" method="post" style="margin: 0px">
					<input type="hidden" name="student_pk" value="{{ student.pk }}" />
					<div class="box" style="padding: 10px;">
						<input class="button" type="button" value="Edytuj" onclick="window.location='/student_form/{{student.pk}}'" />
						<input class="button" type="button" value="Usuń" onclick="document.forms[0].action='/delete_students'; document.forms[0].submit();" />
					</div>
				</form>
				</div>
			</div>
		{%endif%}
	</div>
	{% include "footer.html" %}
</body>
</html>
